import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vueJsx()],
  publicDir: 'publicInjectScritps',
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
      '@c': path.resolve(__dirname, 'src/components'),
      '@d': path.resolve(__dirname, 'src/directives'),
      '@s': path.resolve(__dirname, 'src/scripts'),
    }
  },
  build: {
      outDir: 'dist/inject',
      sourcemap: 'inline',
      // rollupOptions: {
      //   input: 'src/inject.js',
      //   // output: {
      //   //   entryFileNames: '[name].js',
      //   //   chunkFileNames: '[name].js',
      //   // }
      // },
      lib: {
          fileName: 'index',
          entry: 'src/inject.js',
          name: 'inject',
          formats: ['iife'],
      },
  }
})
